package cz.idsv.web.mvc.model.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * Registration Entity.
 * 
 * @author Jan Borzensky
 * @param <Boolen>
 */

@Entity(name = "Registration")
@Table(name = "REGISTRATION")
public class RegistrationEntity implements Serializable {

	private static final long serialVersionUID = -8712872333957386182L;

	private String login = null;
	private Integer id = null;
	private String password = null;
	private Boolean activated = null;
	

	/**
	 * Gets id (primary key).
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	/**
	 * Sets id (primary key).
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * Gets type.
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * Sets type.
	 */
	@Column(name = "PASSWORD")
	public void setPassword(String password) {
		this.password = password;
	}
	

	/**
	 * Gets type.
	 */
	public Boolean getActivated() {
		return activated;
	}
	/**
	 * Sets type.
	 */
	@Column(name = "ACTIVATED")
	public void setActivated(Boolean activated) {
		this.activated = activated;
	}
	/**
	 * Gets type.
	 */
	public String getLogin() {
		return login;
	}
	/**
	 * Sets type.
	 */
	@Column(name = "LOGIN")
	public void setlogin(String login) {
		this.login = login;
	}
	/**
	 * Returns a string representation of the object.
	 */
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();

		sb.append(this.getClass().getName() + "-");
		sb.append("  id=" + id);
		sb.append("  login=" + login);
		sb.append("  password=" + password);
		sb.append("  activated=" + activated);
		

		return sb.toString();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((activated == null) ? 0 : activated.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((login == null) ? 0 : login.hashCode());
		result = prime * result
				+ ((password == null) ? 0 : password.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RegistrationEntity other = (RegistrationEntity) obj;
		if (activated == null) {
			if (other.activated != null)
				return false;
		} else if (!activated.equals(other.activated))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (login == null) {
			if (other.login != null)
				return false;
		} else if (!login.equals(other.login))
			return false;
		if (password == null) {
			if (other.password != null)
				return false;
		} else if (!password.equals(other.password))
			return false;
		return true;
	}

}

